package com.syaccp.controller;

import com.syaccp.model.CustomerIm;
import com.syaccp.request.CustomerImAddRequest;
import com.syaccp.request.CustomerImDeleteRequest;
import com.syaccp.request.CustomerImUpdateRequest;
import com.syaccp.service.CustomerImService;
import com.syaccp.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags = "客户账号")
@RestController
@RequestMapping("/api/customerIm")
public class CustomerImController {

    @Resource
    private CustomerImService cis;


    @PutMapping("/updateIm")
    @ApiOperation(value = "修改客户账号")
    public Result updateIm(@RequestBody @Validated CustomerImUpdateRequest customerImUpdateRequest){
        return cis.updateIm(customerImUpdateRequest);
    }


    @PostMapping("/addIm")
    @ApiOperation(value = "新增客户账号")
    public Result addIm(@RequestBody @Validated CustomerImAddRequest customerImAddRequest){
        return cis.addIm(customerImAddRequest);
    }

    @DeleteMapping("/deleteIm")
    @ApiOperation(value = "新增客户账号")
    public Result deleteIm(@RequestBody @Validated CustomerImDeleteRequest customerImDeleteRequest){
        System.out.println("customerImDeleteRequest = " + customerImDeleteRequest);
        return cis.deleteIm(customerImDeleteRequest);
    }
}
